/**
 * 
 */
package t4j.annotations;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class UseCaseTracker {
	
	public static void trackUseCases(List<Integer> useCases, Class<?> cl) {
		
		for(Method m : cl.getDeclaredMethods()){
			
			UseCase uc = m.getAnnotation(UseCase.class);//获取PasswordUtils.class里面的每个方法的UseCase注解
			
			if(uc != null){
				System.out.println("Found Use Case:" + uc.id() + " " + uc.description());
				useCases.remove(new Integer(uc.id()));//从list删除对应的id
			}
		}
		
		for(int i: useCases)
			System.out.println("Warning:Missing use case-" + i);
	}
	
	public static void main(String[] args) {
		
		List<Integer> useCases = new ArrayList<Integer>();
		Collections.addAll(useCases, 47,48,49,50);//一个list
		trackUseCases(useCases, PasswordUtils.class);
	}
}
